﻿namespace WriterStars.Model
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    public class Contest : IEntity
    {
        private ICollection<ContestBook> contestBooks;

        public Contest()
        {
            this.contestBooks = new HashSet<ContestBook>();
        }

        public int Id { get; set; }

        public DateTime StartDate { get; set; }

        public DateTime EndDate { get; set; }

        [Required]
        public string Name { get; set; }

        [Required]
        public string Regulations { get; set; }

        public virtual ICollection<ContestBook> ContestBooks
        {
            get { return this.contestBooks; }
            set { this.contestBooks = value; }
        }

        public static Contest NoContest()
        {
            return new Contest
            {
                Id = 0,
                Name = "Writer Wars",
                Regulations = "Currently there is no contest available, but any time soon there might be one. You can participate in the contest with not published books only, so keep writing and we will keep you updated."
            };
        }
    }
}